CC=gcc
DIR1=/usr/include/cairo/

LIBGLIB=$(shell pkg-config --libs glib-2.0 clutter-gtk-1.0 clutter-1.0 gtk+-3.0)
CFLAGS= -ggdb -Wall $(shell pkg-config --cflags glib-2.0 clutter-gtk-1.0 clutter-1.0 gtk+-3.0)

INC=$(DIR1)
INCPARAM=$(foreach d, $(INC), -I$d)

OFLAGS= -ggdb

OBJ= main.o Carre.o Cercle.o Dessiner.o Plume.o Rectangle.o Animation.o Afficher_ecran.o Barre_outils_animation.o  Barre_outils_dessins.o Boite_saisie_animation.o Boite_Saisie_Outils.o Scenario.o Menu.o

OBJ_TEST= main_test.o Carre.o Cercle.o Dessiner.o Plume.o Rectangle.o Animation.o Afficher_ecran.o Barre_outils_animation.o  Barre_outils_dessins.o Boite_saisie_animation.o Boite_Saisie_Outils.o Test_Regression.o Scenario.o Menu.o

all: animator test

animator: $(addprefix obj/,$(OBJ))
	$(CC) $(OFLAGS) $(addprefix obj/,$(OBJ)) -o bin/$@ -lcairo $(LIBGLIB)

test: $(addprefix obj/,$(OBJ_TEST))
	$(CC) $(OFLAGS) $(addprefix obj/,$(OBJ_TEST)) -o bin/$@ -lcairo $(LIBGLIB)

obj/%.o: src/%.c src/%.h
	$(CC) $(CFLAGS) $(INCPARAM) -c $< -o $@ 

obj/main.o: src/main.c
	$(CC) $(CFLAGS) $(INCPARAM) -c $< -o $@

obj/main_test.o: src/main_test.c src/Test_Regression.h
	$(CC) $(CFLAGS) $(INCPARAM) -c $< -o $@

clean:
	rm obj/*.o bin/*
